Workbench: Rename orientation to type and Camera studio light to Studio
authorClément Foucault <foucault.clem@gmail.com>
Wed, 28 Nov 2018 21:16:56 +0000 (22:16 +0100)
committerClément Foucault <foucault.clem@gmail.com>
Thu, 29 Nov 2018 20:52:36 +0000 (21:52 +0100)
16 files changed:
release/scripts/startup/bl_operators/wm.py
release/scripts/startup/bl_ui/space_userpref.py
source/blender/blenkernel/BKE_studiolight.h
source/blender/blenkernel/intern/studiolight.c
source/blender/blenloader/intern/versioning_280.c
source/blender/draw/engines/eevee/eevee_lookdev.c
source/blender/draw/engines/workbench/shaders/workbench_deferred_composite_frag.glsl
source/blender/draw/engines/workbench/shaders/workbench_prepass_frag.glsl
source/blender/draw/engines/workbench/workbench_data.c
source/blender/draw/engines/workbench/workbench_deferred.c
source/blender/draw/engines/workbench/workbench_forward.c
source/blender/draw/engines/workbench/workbench_materials.c
source/blender/draw/engines/workbench/workbench_private.h
source/blender/editors/interface/interface_icons.c
source/blender/makesrna/intern/rna_space.c
source/blender/makesrna/intern/rna_userdef.c

index 41a786a41da6172c7f4d0fb14bb07f4bead2ec20..4206adcfb911329f3392ab7d700e835d8784490b 100644 (file)
@@ -2432,11 +2432,11 @@ class WM_OT_studiolight_install(Operator):
         default="*.png;*.jpg;*.hdr;*.exr",
         options={'HIDDEN'},
     )
-    orientation: EnumProperty(
+    type: EnumProperty(
         items=(
             ('MATCAP', "MatCap", ""),
             ('WORLD', "World", ""),
-            ('CAMERA', "Camera", ""),
+            ('STUDIO', "Studio", ""),
         )
     )
 
@@ -2453,7 +2453,7 @@ class WM_OT_studiolight_install(Operator):
             self.report({'ERROR'}, "Failed to get Studio Light path")
             return {'CANCELLED'}
 
-        path_studiolights = pathlib.Path(path_studiolights, "studiolights", self.orientation.lower())
+        path_studiolights = pathlib.Path(path_studiolights, "studiolights", self.type.lower())
         if not path_studiolights.exists():
             try:
                 path_studiolights.mkdir(parents=True, exist_ok=True)
@@ -2462,7 +2462,7 @@ class WM_OT_studiolight_install(Operator):
 
         for filepath in filepaths:
             shutil.copy(str(filepath), str(path_studiolights))
-            userpref.studio_lights.new(str(path_studiolights.joinpath(filepath.name)), self.orientation)
+            userpref.studio_lights.new(str(path_studiolights.joinpath(filepath.name)), self.type)
 
         # print message
         msg = (
index 4d961ef347ad3b164c879656ebfca6713e2b11c7..72b07d55f70392bc8cb0cf29463c8ce54d94279c 100644 (file)
@@ -45,9 +45,9 @@ class USERPREF_HT_header(Header):
             layout.operator("wm.addon_refresh", icon='FILE_REFRESH')
             layout.menu("USERPREF_MT_addons_online_resources")
         elif userpref.active_section == 'LIGHTS':
-            layout.operator('wm.studiolight_install', text="Add MatCap").orientation = 'MATCAP'
-            layout.operator('wm.studiolight_install', text="Add World HDRI").orientation = 'WORLD'
-            layout.operator('wm.studiolight_install', text="Add Camera HDRI").orientation = 'CAMERA'
+            layout.operator('wm.studiolight_install', text="Add MatCap").type = 'MATCAP'
+            layout.operator('wm.studiolight_install', text="Add LookDev HDRI").type = 'WORLD'
+            layout.operator('wm.studiolight_install', text="Add Studio Light").type = 'STUDIO'
         elif userpref.active_section == 'THEMES':
             layout.operator("wm.theme_install", icon='FILEBROWSER')
             layout.operator("ui.reset_default_theme", icon='LOOP_BACK')
@@ -1492,7 +1492,7 @@ class StudioLightPanelMixin():
         return (userpref.active_section == 'LIGHTS')
 
     def _get_lights(self, userpref):
-        return [light for light in userpref.studio_lights if light.is_user_defined and light.orientation == self.sl_orientation]
+        return [light for light in userpref.studio_lights if light.is_user_defined and light.type == self.sl_type]
 
     def draw(self, context):
         layout = self.layout
@@ -1518,22 +1518,17 @@ class StudioLightPanelMixin():
 
 class USERPREF_PT_studiolight_matcaps(Panel, StudioLightPanelMixin):
     bl_label = "MatCaps"
-    sl_orientation = 'MATCAP'
+    sl_type = 'MATCAP'
 
 
 class USERPREF_PT_studiolight_world(Panel, StudioLightPanelMixin):
-    bl_label = "World HDRI"
-    sl_orientation = 'WORLD'
-
-
-class USERPREF_PT_studiolight_camera(Panel, StudioLightPanelMixin):
-    bl_label = "Camera HDRI"
-    sl_orientation = 'CAMERA'
+    bl_label = "LookDev HDRIs"
+    sl_type = 'WORLD'
 
 
 class USERPREF_PT_studiolight_lights(Panel, StudioLightPanelMixin):
     bl_label = "Studio Lights"
-    sl_orientation = 'CAMERA'
+    sl_type = 'STUDIO'
 
     @classmethod
     def poll(cls, context):
@@ -1593,7 +1588,6 @@ classes = (
     USERPREF_PT_studiolight_lights,
     USERPREF_PT_studiolight_matcaps,
     USERPREF_PT_studiolight_world,
-    USERPREF_PT_studiolight_camera,
 )
 
 if __name__ == "__main__":  # only for live edit.
index 7ec98c99c3f99dfc90388029b598313f62550cbf..6616af355ac78180898086e6a1eeb91b33882082 100644 (file)
@@ -82,9 +82,9 @@ enum StudioLightFlag {
 /*     STUDIOLIGHT_LIGHT_DIRECTION_CALCULATED                  = (1 << 1), */
        STUDIOLIGHT_INTERNAL                                    = (1 << 2),
        STUDIOLIGHT_EXTERNAL_FILE                               = (1 << 3),
-       STUDIOLIGHT_ORIENTATION_CAMERA                          = (1 << 4),
-       STUDIOLIGHT_ORIENTATION_WORLD                           = (1 << 5),
-       STUDIOLIGHT_ORIENTATION_VIEWNORMAL                      = (1 << 6),
+       STUDIOLIGHT_TYPE_STUDIO                                 = (1 << 4),
+       STUDIOLIGHT_TYPE_WORLD                                  = (1 << 5),
+       STUDIOLIGHT_TYPE_MATCAP                                 = (1 << 6),
        STUDIOLIGHT_EXTERNAL_IMAGE_LOADED                       = (1 << 7),
        STUDIOLIGHT_EQUIRECT_IRRADIANCE_IMAGE_CALCULATED        = (1 << 8),
        STUDIOLIGHT_EQUIRECT_RADIANCE_GPUTEXTURE                = (1 << 9),
@@ -95,9 +95,9 @@ enum StudioLightFlag {
 };
 
 #define STUDIOLIGHT_FLAG_ALL (STUDIOLIGHT_INTERNAL | STUDIOLIGHT_EXTERNAL_FILE)
-#define STUDIOLIGHT_FLAG_ORIENTATIONS (STUDIOLIGHT_ORIENTATION_CAMERA | STUDIOLIGHT_ORIENTATION_WORLD | STUDIOLIGHT_ORIENTATION_VIEWNORMAL)
-#define STUDIOLIGHT_ORIENTATIONS_MATERIAL_MODE (STUDIOLIGHT_ORIENTATION_WORLD)
-#define STUDIOLIGHT_ORIENTATIONS_SOLID (STUDIOLIGHT_INTERNAL | STUDIOLIGHT_ORIENTATION_CAMERA | STUDIOLIGHT_ORIENTATION_WORLD)
+#define STUDIOLIGHT_FLAG_ORIENTATIONS (STUDIOLIGHT_TYPE_STUDIO | STUDIOLIGHT_TYPE_WORLD | STUDIOLIGHT_TYPE_MATCAP)
+#define STUDIOLIGHT_ORIENTATIONS_MATERIAL_MODE (STUDIOLIGHT_TYPE_WORLD)
+#define STUDIOLIGHT_ORIENTATIONS_SOLID (STUDIOLIGHT_INTERNAL | STUDIOLIGHT_TYPE_STUDIO | STUDIOLIGHT_TYPE_WORLD)
 
 typedef void StudioLightFreeFunction(struct StudioLight *, void *data);
 
index f949fcaea07fd3242d05cf88ece953db4f943469..937c24c47e6cbf2cb71ef1f6e565ee3e373d7568 100644 (file)
@@ -82,7 +82,7 @@ static int last_studiolight_id = 0;
  */
 #define STUDIOLIGHT_LOAD_CACHED_FILES
 
-static const char *STUDIOLIGHT_CAMERA_FOLDER = "studiolights/camera/";
+static const char *STUDIOLIGHT_LIGHTS_FOLDER = "studiolights/light/";
 static const char *STUDIOLIGHT_WORLD_FOLDER = "studiolights/world/";
 static const char *STUDIOLIGHT_MATCAP_FOLDER = "studiolights/matcap/";
 
@@ -168,7 +168,7 @@ static struct StudioLight *studiolight_create(int flag)
        sl->free_function = NULL;
        sl->flag = flag;
        sl->index = ++last_studiolight_id;
-       if (flag & STUDIOLIGHT_ORIENTATION_VIEWNORMAL) {
+       if (flag & STUDIOLIGHT_TYPE_MATCAP) {
                sl->icon_id_matcap = BKE_icon_ensure_studio_light(sl, STUDIOLIGHT_ICON_ID_TYPE_MATCAP);
                sl->icon_id_matcap_flipped = BKE_icon_ensure_studio_light(sl, STUDIOLIGHT_ICON_ID_TYPE_MATCAP_FLIPPED);
        }
@@ -263,7 +263,7 @@ static void studiolight_create_equirect_radiance_gputexture(StudioLight *sl)
                BKE_studiolight_ensure_flag(sl, STUDIOLIGHT_EXTERNAL_IMAGE_LOADED);
                ImBuf *ibuf = sl->equirect_radiance_buffer;
 
-               if (sl->flag & STUDIOLIGHT_ORIENTATION_VIEWNORMAL) {
+               if (sl->flag & STUDIOLIGHT_TYPE_MATCAP) {
                        float *gpu_matcap_3components = MEM_callocN(sizeof(float[3]) * ibuf->x * ibuf->y, __func__);
 
                        float (*offset4)[4] = (float (*)[4])ibuf->rect_float;
@@ -1010,7 +1010,7 @@ void BKE_studiolight_init(void)
        /* order studio lights by name */
        /* Also reserve icon space for it. */
        /* Add default studio light */
-       sl = studiolight_create(STUDIOLIGHT_INTERNAL | STUDIOLIGHT_SPHERICAL_HARMONICS_COEFFICIENTS_CALCULATED | STUDIOLIGHT_ORIENTATION_CAMERA);
+       sl = studiolight_create(STUDIOLIGHT_INTERNAL | STUDIOLIGHT_SPHERICAL_HARMONICS_COEFFICIENTS_CALCULATED | STUDIOLIGHT_TYPE_STUDIO);
        BLI_strncpy(sl->name, "Default", FILE_MAXFILE);
 
        int i = 0;
@@ -1030,12 +1030,12 @@ void BKE_studiolight_init(void)
 
        BLI_addtail(&studiolights, sl);
 
-       studiolight_add_files_from_datafolder(BLENDER_SYSTEM_DATAFILES, STUDIOLIGHT_CAMERA_FOLDER, STUDIOLIGHT_ORIENTATION_CAMERA);
-       studiolight_add_files_from_datafolder(BLENDER_USER_DATAFILES,   STUDIOLIGHT_CAMERA_FOLDER, STUDIOLIGHT_ORIENTATION_CAMERA | STUDIOLIGHT_USER_DEFINED);
-       studiolight_add_files_from_datafolder(BLENDER_SYSTEM_DATAFILES, STUDIOLIGHT_WORLD_FOLDER,  STUDIOLIGHT_ORIENTATION_WORLD);
-       studiolight_add_files_from_datafolder(BLENDER_USER_DATAFILES,   STUDIOLIGHT_WORLD_FOLDER,  STUDIOLIGHT_ORIENTATION_WORLD | STUDIOLIGHT_USER_DEFINED);
-       studiolight_add_files_from_datafolder(BLENDER_SYSTEM_DATAFILES, STUDIOLIGHT_MATCAP_FOLDER, STUDIOLIGHT_ORIENTATION_VIEWNORMAL);
-       studiolight_add_files_from_datafolder(BLENDER_USER_DATAFILES,   STUDIOLIGHT_MATCAP_FOLDER, STUDIOLIGHT_ORIENTATION_VIEWNORMAL | STUDIOLIGHT_USER_DEFINED);
+       studiolight_add_files_from_datafolder(BLENDER_SYSTEM_DATAFILES, STUDIOLIGHT_LIGHTS_FOLDER, STUDIOLIGHT_TYPE_STUDIO);
+       studiolight_add_files_from_datafolder(BLENDER_USER_DATAFILES,   STUDIOLIGHT_LIGHTS_FOLDER, STUDIOLIGHT_TYPE_STUDIO | STUDIOLIGHT_USER_DEFINED);
+       studiolight_add_files_from_datafolder(BLENDER_SYSTEM_DATAFILES, STUDIOLIGHT_WORLD_FOLDER,  STUDIOLIGHT_TYPE_WORLD);
+       studiolight_add_files_from_datafolder(BLENDER_USER_DATAFILES,   STUDIOLIGHT_WORLD_FOLDER,  STUDIOLIGHT_TYPE_WORLD | STUDIOLIGHT_USER_DEFINED);
+       studiolight_add_files_from_datafolder(BLENDER_SYSTEM_DATAFILES, STUDIOLIGHT_MATCAP_FOLDER, STUDIOLIGHT_TYPE_MATCAP);
+       studiolight_add_files_from_datafolder(BLENDER_USER_DATAFILES,   STUDIOLIGHT_MATCAP_FOLDER, STUDIOLIGHT_TYPE_MATCAP | STUDIOLIGHT_USER_DEFINED);
 
        /* sort studio lights on filename. */
        BLI_listbase_sort(&studiolights, studiolight_cmp);
index 906dc96be013478a07bdd3d56284894e3ed54fbb..b2d9a385c6fde95d85820af277b071432554e2c9 100644 (file)
@@ -1670,7 +1670,7 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *bmain)
                        }
                }
                if (!DNA_struct_elem_find(fd->filesdna, "View3DShading", "char", "matcap[256]")) {
-                       StudioLight *default_matcap = BKE_studiolight_find_first(STUDIOLIGHT_ORIENTATION_VIEWNORMAL);
+                       StudioLight *default_matcap = BKE_studiolight_find_first(STUDIOLIGHT_TYPE_MATCAP);
                        /* when loading the internal file is loaded before the matcaps */
                        if (default_matcap) {
                                for (bScreen *screen = bmain->screen.first; screen; screen = screen->id.next) {
index e46526ce6afa4cdd00711b7b3d7d5a510abc601c..298a67b811bc406567a0b3625af740d3adf77f03 100644 (file)
@@ -63,7 +63,7 @@ void EEVEE_lookdev_cache_init(
        View3D *v3d = draw_ctx->v3d;
        if (LOOK_DEV_STUDIO_LIGHT_ENABLED(v3d)) {
                StudioLight *sl = BKE_studiolight_find(v3d->shading.studio_light, STUDIOLIGHT_ORIENTATIONS_MATERIAL_MODE);
-               if (sl && (sl->flag & STUDIOLIGHT_ORIENTATION_WORLD)) {
+               if (sl && (sl->flag & STUDIOLIGHT_TYPE_WORLD)) {
                        GPUShader *shader = EEVEE_shaders_default_studiolight_sh_get();
                        struct GPUBatch *geom = DRW_cache_fullscreen_quad_get();
                        GPUTexture *tex = NULL;
index 4aa471f70d8b91b7eb6e58704511e50c7b026132..54475715d07b97213d487bf928d243bbbc013e0e 100644 (file)
@@ -9,6 +9,7 @@ uniform sampler2D specularBuffer;
 uniform sampler2D normalBuffer;
 /* normalBuffer contains viewport normals */
 uniform sampler2D cavityBuffer;
+uniform sampler2D matcapImage;
 
 uniform vec2 invertedViewportSize;
 uniform vec4 viewvecs[3];
@@ -16,10 +17,6 @@ uniform float shadowMultiplier;
 uniform float lightMultiplier;
 uniform float shadowShift = 0.1;
 
-#ifdef STUDIOLIGHT_ORIENTATION_VIEWNORMAL
-uniform sampler2D matcapImage;
-#endif
-
 layout(std140) uniform world_block {
        WorldData world_data;
 };
index 62c7e4515cdc217bcaeb0e6ba8a942c081b13ee6..5b4a7815dc22ce66e1a0c46612dc35ef32f6aaf7 100644 (file)
@@ -49,7 +49,7 @@ void main()
        }
 #else
        diffuseColor = vec4(materialDiffuseColor.rgb, 0.0);
-#  ifdef STUDIOLIGHT_ORIENTATION_VIEWNORMAL
+#  ifdef STUDIOLIGHT_TYPE_MATCAP
        specularColor = vec4(materialDiffuseColor.rgb, 0.0);
 
 #  endif
index 522b7d6e8c4a495e07f4c89793b7c1485d5e2403..fd72848da493b55b172c49b07e633073abf31ffe 100644 (file)
@@ -36,17 +36,17 @@ void workbench_private_data_init(WORKBENCH_PrivateData *wpd)
 
        if (wpd->shading.light == V3D_LIGHTING_MATCAP) {
                wpd->studio_light = BKE_studiolight_find(
-                       wpd->shading.matcap, STUDIOLIGHT_ORIENTATION_VIEWNORMAL);
+                       wpd->shading.matcap, STUDIOLIGHT_TYPE_MATCAP);
        }
        else {
                wpd->studio_light = BKE_studiolight_find(
-                       wpd->shading.studio_light, STUDIOLIGHT_ORIENTATION_CAMERA | STUDIOLIGHT_ORIENTATION_WORLD);
+                       wpd->shading.studio_light, STUDIOLIGHT_TYPE_STUDIO | STUDIOLIGHT_TYPE_WORLD);
        }
 
        /* If matcaps are missing, use this as fallback. */
        if (UNLIKELY(wpd->studio_light == NULL)) {
                wpd->studio_light = BKE_studiolight_find(
-                       wpd->shading.studio_light, STUDIOLIGHT_ORIENTATION_CAMERA | STUDIOLIGHT_ORIENTATION_WORLD);
+                       wpd->shading.studio_light, STUDIOLIGHT_TYPE_STUDIO | STUDIOLIGHT_TYPE_WORLD);
        }
 
        wpd->shadow_multiplier = 1.0 - wpd->shading.shadow_intensity;
@@ -168,7 +168,7 @@ void workbench_private_data_get_light_direction(WORKBENCH_PrivateData *wpd, floa
        mul_v3_mat3_m4v3(wd->shadow_direction_vs, view_matrix, r_light_direction);
 
        /* TODO enable when we support studiolight presets. */
-       if (STUDIOLIGHT_ORIENTATION_WORLD_ENABLED(wpd) && false) {
+       if (STUDIOLIGHT_TYPE_WORLD_ENABLED(wpd) && false) {
                axis_angle_to_mat4_single(rot_matrix, 'Y', -wpd->shading.studiolight_rot_z);
                mul_m4_m4m4(rot_matrix, rot_matrix, view_matrix);
                swap_v3_v3(rot_matrix[2], rot_matrix[1]);
index 5c65cf78820e0c49ac4d2c73810c30dc9ed49512..b801181e1fce301ee82a5e66bd04673631580563 100644 (file)
@@ -512,7 +512,7 @@ static void workbench_composite_uniforms(WORKBENCH_PrivateData *wpd, DRWShadingG
        DRW_shgroup_uniform_block(grp, "world_block", wpd->world_ubo);
        DRW_shgroup_uniform_vec2(grp, "invertedViewportSize", DRW_viewport_invert_size_get(), 1);
 
-       if (STUDIOLIGHT_ORIENTATION_VIEWNORMAL_ENABLED(wpd)) {
+       if (STUDIOLIGHT_TYPE_MATCAP_ENABLED(wpd)) {
                BKE_studiolight_ensure_flag(wpd->studio_light, STUDIOLIGHT_EQUIRECT_RADIANCE_GPUTEXTURE);
                DRW_shgroup_uniform_texture(grp, "matcapImage", wpd->studio_light->equirect_radiance_gputexture );
        }
index 4365f4ec27cef2bb1fd3804be8d711027e8973b6..3a5e592fa691adc5f06e6a9491c823b583c099b3 100644 (file)
@@ -168,7 +168,7 @@ static WORKBENCH_MaterialData *get_or_create_material_data(
                DRW_shgroup_uniform_float(grp, "alpha", &wpd->shading.xray_alpha, 1);
                DRW_shgroup_uniform_vec4(grp, "viewvecs[0]", (float *)wpd->viewvecs, 3);
                workbench_material_copy(material, &material_template);
-               if (STUDIOLIGHT_ORIENTATION_VIEWNORMAL_ENABLED(wpd)) {
+               if (STUDIOLIGHT_TYPE_MATCAP_ENABLED(wpd)) {
                        BKE_studiolight_ensure_flag(wpd->studio_light, STUDIOLIGHT_EQUIRECT_RADIANCE_GPUTEXTURE);
                        DRW_shgroup_uniform_texture(grp, "matcapImage", wpd->studio_light->equirect_radiance_gputexture );
                }
@@ -450,7 +450,7 @@ static void workbench_forward_cache_populate_particles(WORKBENCH_Data *vedata, O
                         * So lower their alpha artificially. */
                        float hair_alpha = XRAY_ALPHA(wpd) * 0.33f;
                        DRW_shgroup_uniform_float_copy(shgrp, "alpha", hair_alpha);
-                       if (STUDIOLIGHT_ORIENTATION_VIEWNORMAL_ENABLED(wpd)) {
+                       if (STUDIOLIGHT_TYPE_MATCAP_ENABLED(wpd)) {
                                BKE_studiolight_ensure_flag(wpd->studio_light, STUDIOLIGHT_EQUIRECT_RADIANCE_GPUTEXTURE);
                                DRW_shgroup_uniform_texture(shgrp, "matcapImage", wpd->studio_light->equirect_radiance_gputexture );
                        }
index cf0ed3147d094dc672c59391bac38f34d73d4681..42e52e037f3ae51407339e87e7f29069001e20cb 100644 (file)
@@ -83,14 +83,14 @@ char *workbench_material_build_defines(WORKBENCH_PrivateData *wpd, bool use_text
        if (MATCAP_ENABLED(wpd)) {
                BLI_dynstr_appendf(ds, "#define V3D_LIGHTING_MATCAP\n");
        }
-       if (STUDIOLIGHT_ORIENTATION_WORLD_ENABLED(wpd)) {
-               BLI_dynstr_appendf(ds, "#define STUDIOLIGHT_ORIENTATION_WORLD\n");
+       if (STUDIOLIGHT_TYPE_WORLD_ENABLED(wpd)) {
+               BLI_dynstr_appendf(ds, "#define STUDIOLIGHT_TYPE_WORLD\n");
        }
-       if (STUDIOLIGHT_ORIENTATION_CAMERA_ENABLED(wpd)) {
-               BLI_dynstr_appendf(ds, "#define STUDIOLIGHT_ORIENTATION_CAMERA\n");
+       if (STUDIOLIGHT_TYPE_STUDIO_ENABLED(wpd)) {
+               BLI_dynstr_appendf(ds, "#define STUDIOLIGHT_TYPE_STUDIO\n");
        }
-       if (STUDIOLIGHT_ORIENTATION_VIEWNORMAL_ENABLED(wpd)) {
-               BLI_dynstr_appendf(ds, "#define STUDIOLIGHT_ORIENTATION_VIEWNORMAL\n");
+       if (STUDIOLIGHT_TYPE_MATCAP_ENABLED(wpd)) {
+               BLI_dynstr_appendf(ds, "#define STUDIOLIGHT_TYPE_MATCAP\n");
        }
        if (NORMAL_VIEWPORT_PASS_ENABLED(wpd)) {
                BLI_dynstr_appendf(ds, "#define NORMAL_VIEWPORT_PASS_ENABLED\n");
@@ -158,8 +158,8 @@ int workbench_material_get_shader_index(WORKBENCH_PrivateData *wpd, bool use_tex
        SET_FLAG_FROM_TEST(index, uses_curvature, 1 << 7);
        SET_FLAG_FROM_TEST(index, uses_curvature && (U.pixelsize > 1.5f), 1 << 8);
        /* 2 bits STUDIOLIGHT_ORIENTATION */
-       SET_FLAG_FROM_TEST(index, wpd->studio_light->flag & STUDIOLIGHT_ORIENTATION_WORLD, 1 << 9);
-       SET_FLAG_FROM_TEST(index, wpd->studio_light->flag & STUDIOLIGHT_ORIENTATION_VIEWNORMAL, 1 << 10);
+       SET_FLAG_FROM_TEST(index, wpd->studio_light->flag & STUDIOLIGHT_TYPE_WORLD, 1 << 9);
+       SET_FLAG_FROM_TEST(index, wpd->studio_light->flag & STUDIOLIGHT_TYPE_MATCAP, 1 << 10);
        /* 1 bit for hair */
        SET_FLAG_FROM_TEST(index, is_hair, 1 << 11);
        return index;
index 74764a1b15950512fbba102b1b4af13bb26988e7..4ab0d39aa5590465ac7af3beb2015decad727fc6 100644 (file)
@@ -46,9 +46,9 @@
 #define FLAT_ENABLED(wpd) (wpd->shading.light == V3D_LIGHTING_FLAT)
 #define STUDIOLIGHT_ENABLED(wpd) (wpd->shading.light == V3D_LIGHTING_STUDIO)
 #define MATCAP_ENABLED(wpd) (wpd->shading.light == V3D_LIGHTING_MATCAP)
-#define STUDIOLIGHT_ORIENTATION_WORLD_ENABLED(wpd) (STUDIOLIGHT_ENABLED(wpd) && (wpd->studio_light->flag & STUDIOLIGHT_ORIENTATION_WORLD))
-#define STUDIOLIGHT_ORIENTATION_CAMERA_ENABLED(wpd) (STUDIOLIGHT_ENABLED(wpd) && (wpd->studio_light->flag & STUDIOLIGHT_ORIENTATION_CAMERA))
-#define STUDIOLIGHT_ORIENTATION_VIEWNORMAL_ENABLED(wpd) (MATCAP_ENABLED(wpd) && (wpd->studio_light->flag & STUDIOLIGHT_ORIENTATION_VIEWNORMAL))
+#define STUDIOLIGHT_TYPE_WORLD_ENABLED(wpd) (STUDIOLIGHT_ENABLED(wpd) && (wpd->studio_light->flag & STUDIOLIGHT_TYPE_WORLD))
+#define STUDIOLIGHT_TYPE_STUDIO_ENABLED(wpd) (STUDIOLIGHT_ENABLED(wpd) && (wpd->studio_light->flag & STUDIOLIGHT_TYPE_STUDIO))
+#define STUDIOLIGHT_TYPE_MATCAP_ENABLED(wpd) (MATCAP_ENABLED(wpd) && (wpd->studio_light->flag & STUDIOLIGHT_TYPE_MATCAP))
 #define SSAO_ENABLED(wpd) ((wpd->shading.flag & V3D_SHADING_CAVITY) && ((wpd->shading.cavity_type == V3D_SHADING_CAVITY_SSAO) || (wpd->shading.cavity_type == V3D_SHADING_CAVITY_BOTH)))
 #define CURVATURE_ENABLED(wpd) ((wpd->shading.flag & V3D_SHADING_CAVITY) && ((wpd->shading.cavity_type == V3D_SHADING_CAVITY_CURVATURE) || (wpd->shading.cavity_type == V3D_SHADING_CAVITY_BOTH)))
 #define SHADOW_ENABLED(wpd) (wpd->shading.flag & V3D_SHADING_SHADOW)
@@ -59,7 +59,7 @@
                             (IN_RANGE(wpd->user_preferences->gpu_viewport_quality, GPU_VIEWPORT_QUALITY_FXAA, GPU_VIEWPORT_QUALITY_TAA8) || \
                              ((IS_NAVIGATING(wpd) || wpd->is_playback) && (wpd->user_preferences->gpu_viewport_quality >= GPU_VIEWPORT_QUALITY_TAA8))))
 #define TAA_ENABLED(wpd) (DRW_state_is_image_render() || (wpd->user_preferences->gpu_viewport_quality >= GPU_VIEWPORT_QUALITY_TAA8 && !IS_NAVIGATING(wpd) && !wpd->is_playback))
-#define SPECULAR_HIGHLIGHT_ENABLED(wpd) (STUDIOLIGHT_ENABLED(wpd) && (wpd->shading.flag & V3D_SHADING_SPECULAR_HIGHLIGHT) && (!STUDIOLIGHT_ORIENTATION_VIEWNORMAL_ENABLED(wpd)))
+#define SPECULAR_HIGHLIGHT_ENABLED(wpd) (STUDIOLIGHT_ENABLED(wpd) && (wpd->shading.flag & V3D_SHADING_SPECULAR_HIGHLIGHT) && (!STUDIOLIGHT_TYPE_MATCAP_ENABLED(wpd)))
 #define OBJECT_OUTLINE_ENABLED(wpd) (wpd->shading.flag & V3D_SHADING_OBJECT_OUTLINE)
 #define OBJECT_ID_PASS_ENABLED(wpd) (OBJECT_OUTLINE_ENABLED(wpd) || CURVATURE_ENABLED(wpd))
 #define NORMAL_VIEWPORT_COMP_PASS_ENABLED(wpd) (MATCAP_ENABLED(wpd) || STUDIOLIGHT_ENABLED(wpd) || SHADOW_ENABLED(wpd) || SPECULAR_HIGHLIGHT_ENABLED(wpd) || CURVATURE_ENABLED(wpd))
index d8bdeaa8159075372ab52bae5bd3e2bcd912dcdb..36624f475ce75b58fe3baa28366f2c4eae92d0f8 100644 (file)
@@ -1842,12 +1842,12 @@ int UI_rnaptr_icon_get(bContext *C, PointerRNA *ptr, int rnaicon, const bool big
        else if (RNA_struct_is_a(ptr->type, &RNA_StudioLight)) {
                StudioLight *sl = ptr->data;
                switch (sl->flag & STUDIOLIGHT_FLAG_ORIENTATIONS) {
-                       case STUDIOLIGHT_ORIENTATION_CAMERA:
+                       case STUDIOLIGHT_TYPE_STUDIO:
                                return sl->icon_id_irradiance;
-                       case STUDIOLIGHT_ORIENTATION_WORLD:
+                       case STUDIOLIGHT_TYPE_WORLD:
                        default:
                                return sl->icon_id_radiance;
-                       case STUDIOLIGHT_ORIENTATION_VIEWNORMAL:
+                       case STUDIOLIGHT_TYPE_MATCAP:
                                return sl->icon_id_matcap;
                }
        }
index 981aac18894b28bf2a44622ab26645a074d972e0..fd6e7436351fcbd6fd02450fab83dc0645fc45bf 100644 (file)
@@ -807,7 +807,7 @@ static int rna_View3DShading_studio_light_get(PointerRNA *ptr)
 
        int flag = STUDIOLIGHT_ORIENTATIONS_SOLID;
        if (shading->type == OB_SOLID && shading->light == V3D_LIGHTING_MATCAP) {
-               flag = STUDIOLIGHT_ORIENTATION_VIEWNORMAL;
+               flag = STUDIOLIGHT_TYPE_MATCAP;
                dna_storage = shading->matcap;
        }
        else if (shading->type == OB_MATERIAL) {
@@ -830,7 +830,7 @@ static void rna_View3DShading_studio_light_set(PointerRNA *ptr, int value)
 
        int flag = STUDIOLIGHT_ORIENTATIONS_SOLID;
        if (shading->type == OB_SOLID && shading->light == V3D_LIGHTING_MATCAP) {
-               flag = STUDIOLIGHT_ORIENTATION_VIEWNORMAL;
+               flag = STUDIOLIGHT_TYPE_MATCAP;
                dna_storage = shading->matcap;
        }
        else if (shading->type == OB_MATERIAL) {
@@ -851,7 +851,7 @@ static const EnumPropertyItem *rna_View3DShading_studio_light_itemf(
        int totitem = 0;
 
        if (shading->type == OB_SOLID && shading->light == V3D_LIGHTING_MATCAP) {
-               const int flags = (STUDIOLIGHT_EXTERNAL_FILE | STUDIOLIGHT_ORIENTATION_VIEWNORMAL);
+               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;
@@ -877,11 +877,11 @@ static const EnumPropertyItem *rna_View3DShading_studio_light_itemf(
                                        case OB_SOLID:
                                        case OB_TEXTURE:
                                                show_studiolight = (
-                                                       (sl->flag & (STUDIOLIGHT_ORIENTATION_WORLD | STUDIOLIGHT_ORIENTATION_CAMERA)) != 0);
+                                                       (sl->flag & (STUDIOLIGHT_TYPE_WORLD | STUDIOLIGHT_TYPE_STUDIO)) != 0);
                                                break;
 
                                        case OB_MATERIAL:
-                                               show_studiolight = ((sl->flag & STUDIOLIGHT_ORIENTATION_WORLD) != 0);
+                                               show_studiolight = ((sl->flag & STUDIOLIGHT_TYPE_WORLD) != 0);
                                                icon_id = sl->icon_id_radiance;
                                                break;
                                }
index 3610a9b8514ace04bd3cf9e5a7c188d9ec54b516..89f777625a0e6072f811425bfce34a9f2ccde8fe 100644 (file)
@@ -87,10 +87,10 @@ static const EnumPropertyItem rna_enum_language_default_items[] = {
 };
 #endif
 
-static const EnumPropertyItem rna_enum_studio_light_orientation_items[] = {
-       {STUDIOLIGHT_ORIENTATION_CAMERA,     "CAMERA", 0, "Camera", ""},
-       {STUDIOLIGHT_ORIENTATION_WORLD,      "WORLD",  0, "World",  ""},
-       {STUDIOLIGHT_ORIENTATION_VIEWNORMAL, "MATCAP", 0, "MatCap", ""},
+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}
 };
 
@@ -628,9 +628,9 @@ static void rna_StudioLights_remove(UserDef *UNUSED(userdef), StudioLight *studi
        BKE_studiolight_remove(studio_light);
 }
 
-static StudioLight *rna_StudioLights_new(UserDef *UNUSED(userdef), const char *path, int orientation)
+static StudioLight *rna_StudioLights_new(UserDef *UNUSED(userdef), const char *path, int type)
 {
-       return BKE_studiolight_new(path, orientation);
+       return BKE_studiolight_new(path, type);
 }
 
 /* StudioLight.name */
@@ -715,9 +715,9 @@ static bool rna_UserDef_studiolight_is_user_defined_get(PointerRNA *ptr)
        return (sl->flag & STUDIOLIGHT_USER_DEFINED) != 0;
 }
 
-/* StudioLight.orientation */
+/* StudioLight.type */
 
-static int rna_UserDef_studiolight_orientation_get(PointerRNA *ptr)
+static int rna_UserDef_studiolight_type_get(PointerRNA *ptr)
 {
        StudioLight *sl = (StudioLight *)ptr->data;
        return sl->flag & STUDIOLIGHT_FLAG_ORIENTATIONS;
@@ -3319,7 +3319,7 @@ static void rna_def_userdef_studiolights(BlenderRNA *brna)
        RNA_def_function_ui_description(func, "Create a new studiolight");
        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, "orientation", rna_enum_studio_light_orientation_items, STUDIOLIGHT_ORIENTATION_WORLD, "Orientation", "The orientation for the new studio light");
+       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);
@@ -3353,11 +3353,11 @@ static void rna_def_userdef_studiolight(BlenderRNA *brna)
        RNA_def_property_clear_flag(prop, PROP_EDITABLE);
        RNA_def_property_ui_text(prop, "User Defined", "");
 
-       prop = RNA_def_property(srna, "orientation", PROP_ENUM, PROP_NONE);
-       RNA_def_property_enum_items(prop, rna_enum_studio_light_orientation_items);
-       RNA_def_property_enum_funcs(prop, "rna_UserDef_studiolight_orientation_get", NULL, NULL);
+       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, "Orientation", "");
+       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);