Revision: 21586
          
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=21586
Author:   yukishiro
Date:     2009-07-14 22:49:45 +0200 (Tue, 14 Jul 2009)

Log Message:
-----------
move lightenv node to texture node mode and hide lightenv type from users

Modified Paths:
--------------
    branches/soc-2009-yukishiro/release/ui/buttons_lightenv.py
    branches/soc-2009-yukishiro/source/blender/blenkernel/BKE_icons.h
    branches/soc-2009-yukishiro/source/blender/blenkernel/BKE_lightenv.h
    branches/soc-2009-yukishiro/source/blender/blenkernel/BKE_node.h
    branches/soc-2009-yukishiro/source/blender/blenkernel/intern/lightenv.c
    branches/soc-2009-yukishiro/source/blender/blenkernel/intern/node.c
    branches/soc-2009-yukishiro/source/blender/editors/preview/previewrender.c
    
branches/soc-2009-yukishiro/source/blender/editors/space_buttons/buttons_intern.h
    
branches/soc-2009-yukishiro/source/blender/editors/space_buttons/buttons_ops.c
    
branches/soc-2009-yukishiro/source/blender/editors/space_buttons/space_buttons.c
    branches/soc-2009-yukishiro/source/blender/editors/space_node/drawnode.c
    branches/soc-2009-yukishiro/source/blender/editors/space_node/node_edit.c
    branches/soc-2009-yukishiro/source/blender/editors/space_node/node_header.c
    branches/soc-2009-yukishiro/source/blender/editors/space_node/node_intern.h
    branches/soc-2009-yukishiro/source/blender/editors/space_node/space_node.c
    
branches/soc-2009-yukishiro/source/blender/editors/space_view3d/space_view3d.c
    branches/soc-2009-yukishiro/source/blender/makesdna/DNA_lightenv_types.h
    branches/soc-2009-yukishiro/source/blender/makesdna/DNA_node_types.h
    branches/soc-2009-yukishiro/source/blender/makesrna/intern/rna_scene.c
    branches/soc-2009-yukishiro/source/blender/nodes/SConscript
    branches/soc-2009-yukishiro/source/blender/nodes/TEX_node.h
    branches/soc-2009-yukishiro/source/blender/nodes/intern/TEX_util.h
    branches/soc-2009-yukishiro/source/blender/sh/SH_api.h
    branches/soc-2009-yukishiro/source/blender/sh/intern/compute.c

Removed Paths:
-------------
    branches/soc-2009-yukishiro/source/blender/nodes/LGT_node.h
    branches/soc-2009-yukishiro/source/blender/nodes/intern/LGT_nodes/
    branches/soc-2009-yukishiro/source/blender/nodes/intern/LGT_util.c
    branches/soc-2009-yukishiro/source/blender/nodes/intern/LGT_util.h

Modified: branches/soc-2009-yukishiro/release/ui/buttons_lightenv.py
===================================================================
--- branches/soc-2009-yukishiro/release/ui/buttons_lightenv.py  2009-07-14 
20:38:21 UTC (rev 21585)
+++ branches/soc-2009-yukishiro/release/ui/buttons_lightenv.py  2009-07-14 
20:49:45 UTC (rev 21586)
@@ -9,6 +9,35 @@
        def poll(self, context):
                return context.lightenv
 
+class LIGHT_PT_preview(LightButtonsPanel):
+       __idname__= "LIGHT_PT_preview"
+       __label__ = "Preview"
+
+       def draw(self, context):
+               layout = self.layout
+
+                lightenv = context.lightenv
+               layout.template_preview(lightenv)
+
+
+class LIGHT_PT_context_lightenv(LightButtonsPanel):
+       __no_header__ = True
+
+       def draw(self, context):
+               layout = self.layout
+               
+               scene = context.scene
+               env = context.lightenv
+               space = context.space_data
+
+               split = layout.split(percentage=0.65)
+
+               if scene:
+                       split.template_ID(scene, "lightenv", 
new="LIGHTENV_OT_new")
+               elif world:
+                       split.template_ID(space, "pin_id")
+
+
 class LIGHT_PT_properties(LightButtonsPanel):
        __idname__= "LIGHT_PT_properties"
        __label__ = "Properties"
@@ -24,6 +53,7 @@
                row = layout.row()
                row.itemO("PAINT_OT_light_paint_recompute", text="Recompute 
LightEnv", icon='ICON_LIGHTENV')
 
+
 class LIGHT_PT_save(LightButtonsPanel):
        __idname__= "LIGHT_PT_save"
        __label__ = "Save Light Env"
@@ -40,29 +70,6 @@
                row.itemO("PAINT_OT_light_paint_save", text="Save LightEnv")
 
 
-
-class LIGHT_PT_preview(LightButtonsPanel):
-       __idname__= "LIGHT_PT_preview"
-       __label__ = "Preview"
-
-       def draw(self, context):
-               layout = self.layout
-
-                lightenv = context.lightenv
-               layout.template_preview(lightenv)
-
-
-class LIGHT_PT_type(LightButtonsPanel):
-       __idname__= "LIGHT_PT_type"
-       __label__ = "Light Environment Type"
-
-       def draw(self, context):
-               layout = self.layout
-                lightenv = context.lightenv
-                
-               row = layout.row()
-               row.itemR(lightenv, "type", text="Type")
-
 class LIGHT_PT_probe_image(LightButtonsPanel):
         __idname__= "LIGHT_PT_probe_image"
         __label__ = "Probe Image"
@@ -80,8 +87,9 @@
                 #split.template_ID(context, lightenv, "probe_image", 
new="IMAGE_OT_open")
                layout.itemR(lightenv, "probe_image")
 
+
+bpy.types.register(LIGHT_PT_context_lightenv)
 bpy.types.register(LIGHT_PT_properties)
 bpy.types.register(LIGHT_PT_preview)
 bpy.types.register(LIGHT_PT_save)
-bpy.types.register(LIGHT_PT_type)
 bpy.types.register(LIGHT_PT_probe_image)

Modified: branches/soc-2009-yukishiro/source/blender/blenkernel/BKE_icons.h
===================================================================
--- branches/soc-2009-yukishiro/source/blender/blenkernel/BKE_icons.h   
2009-07-14 20:38:21 UTC (rev 21585)
+++ branches/soc-2009-yukishiro/source/blender/blenkernel/BKE_icons.h   
2009-07-14 20:49:45 UTC (rev 21586)
@@ -74,7 +74,7 @@
 void BKE_previewimg_free(struct PreviewImage **prv);
 
 /* free the preview image belonging to the id */
-void BKE_previewimg_free_id(ID *id);
+void BKE_previewimg_free_id(struct ID *id);
 
 /* create a new preview image */
 struct PreviewImage* BKE_previewimg_create() ;
@@ -83,6 +83,6 @@
 struct PreviewImage* BKE_previewimg_copy(struct PreviewImage *prv);
 
 /* retrieve existing or create new preview image */
-PreviewImage* BKE_previewimg_get(ID *id);
+struct PreviewImage* BKE_previewimg_get(struct ID *id);
 
 #endif /*  BKE_ICONS_H */

Modified: branches/soc-2009-yukishiro/source/blender/blenkernel/BKE_lightenv.h
===================================================================
--- branches/soc-2009-yukishiro/source/blender/blenkernel/BKE_lightenv.h        
2009-07-14 20:38:21 UTC (rev 21585)
+++ branches/soc-2009-yukishiro/source/blender/blenkernel/BKE_lightenv.h        
2009-07-14 20:49:45 UTC (rev 21586)
@@ -35,12 +35,14 @@
 extern "C" {
 #endif
 
+#include "BKE_icons.h"
+
 struct LightEnv;
 struct Image;
 
-void init_def_lightenv(void);
 void free_lightenv(struct LightEnv *env); 
 struct LightEnv* add_lightenv(char *name);
+struct LightEnv* copy_lightenv(struct LightEnv *env);
 void save_lightenv(struct LightEnv *env, char *image_name, int imtype);
 
 void update_light_func(struct LightEnv *env);

Modified: branches/soc-2009-yukishiro/source/blender/blenkernel/BKE_node.h
===================================================================
--- branches/soc-2009-yukishiro/source/blender/blenkernel/BKE_node.h    
2009-07-14 20:38:21 UTC (rev 21585)
+++ branches/soc-2009-yukishiro/source/blender/blenkernel/BKE_node.h    
2009-07-14 20:49:45 UTC (rev 21586)
@@ -411,20 +411,13 @@
 #define TEX_NODE_VALTONOR   421
 #define TEX_NODE_SCALE      422
 #define TEX_NODE_AT         423
+#define TEX_NODE_LIGHTENV   424
 
 /* 501-599 reserved. Use like this: TEX_NODE_PROC + TEX_CLOUDS, etc */
 #define TEX_NODE_PROC      500
 #define TEX_NODE_PROC_MAX  600
 
 
-/* *************** LIGHT NODES ************** */
-
-#define LGT_NODE_OUTPUT                601
-#define LGT_NODE_LIGHTENV      602
-#define LGT_NODE_IMAGE         603
-#define LGT_NODE_MIX_RGB       604
-#define LGT_NODE_OUTPUT_FILE   605
-
 extern struct ListBase node_all_textures;
 
 /* API */

Modified: 
branches/soc-2009-yukishiro/source/blender/blenkernel/intern/lightenv.c
===================================================================
--- branches/soc-2009-yukishiro/source/blender/blenkernel/intern/lightenv.c     
2009-07-14 20:38:21 UTC (rev 21585)
+++ branches/soc-2009-yukishiro/source/blender/blenkernel/intern/lightenv.c     
2009-07-14 20:49:45 UTC (rev 21586)
@@ -37,11 +37,9 @@
 #include "BKE_blender.h"
 #include "BKE_displist.h"
 #include "BKE_global.h"
-//#include "BKE_icons.h"
 #include "BKE_image.h"
 #include "BKE_library.h"
 #include "BKE_main.h"
-#include "BKE_node.h"
 
 #include "DNA_lightenv_types.h"
 #include "DNA_world_types.h"
@@ -133,11 +131,6 @@
 
 void free_lightenv(LightEnv *env)
 {
-       if (env->nodetree) {
-               ntreeFreeTree(env->nodetree);
-               MEM_freeN(env->nodetree);
-       }
-
        if (env->preview) {
                BKE_previewimg_free(&env->preview);
        }
@@ -159,3 +152,24 @@
        return env;
 }
 
+
+LightEnv * copy_lightenv(LightEnv *env)
+{
+       LightEnv *new_env;
+       
+       new_env= copy_libblock(env);
+
+       new_env->type = env->type;
+       new_env->light_func = env->light_func;
+       new_env->degree = env->degree;
+       new_env->num_samples = env->num_samples;
+       new_env->output_width = env->output_width;
+       new_env->output_height = env->output_height;
+
+       if (env->preview) new_env->preview = BKE_previewimg_copy(env->preview);
+#ifndef DISABLE_PYTHON
+       BPY_copy_scriptlink(&env->scriptlink);
+#endif
+
+       return new_env;
+}

Modified: branches/soc-2009-yukishiro/source/blender/blenkernel/intern/node.c
===================================================================
--- branches/soc-2009-yukishiro/source/blender/blenkernel/intern/node.c 
2009-07-14 20:38:21 UTC (rev 21585)
+++ branches/soc-2009-yukishiro/source/blender/blenkernel/intern/node.c 
2009-07-14 20:49:45 UTC (rev 21586)
@@ -74,8 +74,6 @@
 #include "TEX_node.h"
 #include "intern/TEX_util.h"
 
-#include "LGT_node.h"
-
 #include "GPU_extensions.h"
 #include "GPU_material.h"
 
@@ -83,7 +81,6 @@
 ListBase node_all_composit = {NULL, NULL};
 ListBase node_all_shaders = {NULL, NULL};
 ListBase node_all_textures = {NULL, NULL};
-ListBase node_all_light = {NULL, NULL};
 
 /* ************** Type stuff **********  */
 
@@ -115,8 +112,6 @@
                ntree->alltypes= node_all_composit;
        else if(ntree->type==NTREE_TEXTURE)
                ntree->alltypes= node_all_textures;
-       else if(ntree->type==NTREE_LIGHT)
-               ntree->alltypes= node_all_light;
        else {
                ntree->alltypes= empty_list;
                printf("Error: no type definitions for nodes\n");
@@ -1068,8 +1063,6 @@
                BLI_strncpy(ntree->id.name, "NTComposit Nodetree", 
sizeof(ntree->id.name));
        else if(ntree->type==NTREE_TEXTURE)
                BLI_strncpy(ntree->id.name, "NTTexture Nodetree", 
sizeof(ntree->id.name));
-       else if(ntree->type==NTREE_LIGHT)
-               BLI_strncpy(ntree->id.name, "NTLight Nodetree", 
sizeof(ntree->id.name));
        
        ntreeInitTypes(ntree);
        return ntree;
@@ -3053,6 +3046,7 @@
        nodeRegisterType(ntypelist, &tex_node_texture);
        nodeRegisterType(ntypelist, &tex_node_bricks);
        nodeRegisterType(ntypelist, &tex_node_image);
+       nodeRegisterType(ntypelist, &tex_node_lightenv);
        
        nodeRegisterType(ntypelist, &tex_node_rotate);
        nodeRegisterType(ntypelist, &tex_node_translate);
@@ -3071,13 +3065,6 @@
        nodeRegisterType(ntypelist, &tex_node_proc_distnoise);
 }
 
-static void registerLightNodes(ListBase *ntypelist)
-{
-       nodeRegisterType(ntypelist, &lgt_node_output);
-       nodeRegisterType(ntypelist, &lgt_node_lightenv);
-       nodeRegisterType(ntypelist, &lgt_node_image);
-       nodeRegisterType(ntypelist, &lgt_node_output_file);
-}
 
 static void remove_dynamic_typeinfos(ListBase *list)
 {
@@ -3117,7 +3104,6 @@
        registerCompositNodes(&node_all_composit);
        registerShaderNodes(&node_all_shaders);
        registerTextureNodes(&node_all_textures);
-       registerLightNodes(&node_all_light);
 }
 
 void free_nodesystem(void) 
@@ -3127,5 +3113,4 @@
        remove_dynamic_typeinfos(&node_all_shaders);
        BLI_freelistN(&node_all_shaders);
        BLI_freelistN(&node_all_textures);
-       BLI_freelistN(&node_all_light);
 }

Modified: 
branches/soc-2009-yukishiro/source/blender/editors/preview/previewrender.c
===================================================================
--- branches/soc-2009-yukishiro/source/blender/editors/preview/previewrender.c  
2009-07-14 20:38:21 UTC (rev 21585)
+++ branches/soc-2009-yukishiro/source/blender/editors/preview/previewrender.c  
2009-07-14 20:49:45 UTC (rev 21586)
@@ -915,10 +915,6 @@
 {
        LightEnv * env = (LightEnv *)id;
 
-       if(env->nodetree && env->use_nodes) {
-               ntreeLightExecTree(env->nodetree, env);
-       }
-
        // TODO write to env's preview
        PreviewImage * preview = BKE_previewimg_get(id);
        if (preview->rectf) MEM_freeN(preview->rectf);

Modified: 
branches/soc-2009-yukishiro/source/blender/editors/space_buttons/buttons_intern.h
===================================================================
--- 
branches/soc-2009-yukishiro/source/blender/editors/space_buttons/buttons_intern.h
   2009-07-14 20:38:21 UTC (rev 21585)
+++ 
branches/soc-2009-yukishiro/source/blender/editors/space_buttons/buttons_intern.h
   2009-07-14 20:49:45 UTC (rev 21586)
@@ -70,6 +70,7 @@
 void MATERIAL_OT_new(struct wmOperatorType *ot);
 void TEXTURE_OT_new(struct wmOperatorType *ot);
 void WORLD_OT_new(struct wmOperatorType *ot);
+void LIGHTENV_OT_new(struct wmOperatorType *ot);
 
 void OBJECT_OT_particle_system_add(struct wmOperatorType *ot);

@@ Diff output truncated at 10240 characters. @@

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to