rna structs would not raise an error when assigning invalid properties
authorCampbell Barton <ideasman42@gmail.com>
Sun, 1 Nov 2009 21:53:45 +0000 (21:53 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Sun, 1 Nov 2009 21:53:45 +0000 (21:53 +0000)
netrender needed updating for this.
 hint, bpy.data is not a module

release/scripts/io/netrender/__init__.py
release/scripts/io/netrender/operators.py
release/scripts/io/netrender/ui.py
source/blender/python/intern/bpy_rna.c

index 18da5e2..be3d25d 100644 (file)
@@ -32,6 +32,7 @@ import ui
 
 import bpy
 
-bpy.data.netrender_jobs = []
-bpy.data.netrender_slaves = []
-bpy.data.netrender_blacklist = []
\ No newline at end of file
+bpy.netrender_jobs = []
+bpy.netrender_slaves = []
+bpy.netrender_blacklist = []
+
index 0caa393..8f727ca 100644 (file)
@@ -99,10 +99,10 @@ class RENDER_OT_netclientstatus(bpy.types.Operator):
                        while(len(netsettings.jobs) > 0):
                                netsettings.jobs.remove(0)
                        
-                       bpy.data.netrender_jobs = []
+                       bpy.netrender_jobs = []
                        
                        for j in jobs:
-                               bpy.data.netrender_jobs.append(j)
+                               bpy.netrender_jobs.append(j)
                                netsettings.jobs.add()
                                job = netsettings.jobs[-1]
                                
@@ -130,8 +130,8 @@ class RENDER_OT_netclientblacklistslave(bpy.types.Operator):
                if netsettings.active_slave_index >= 0:
                        
                        # deal with data
-                       slave = bpy.data.netrender_slaves.pop(netsettings.active_slave_index)
-                       bpy.data.netrender_blacklist.append(slave)
+                       slave = bpy.netrender_slaves.pop(netsettings.active_slave_index)
+                       bpy.netrender_blacklist.append(slave)
                        
                        # deal with rna
                        netsettings.slaves_blacklist.add()
@@ -160,8 +160,8 @@ class RENDER_OT_netclientwhitelistslave(bpy.types.Operator):
                if netsettings.active_blacklisted_slave_index >= 0:
                        
                        # deal with data
-                       slave = bpy.data.netrender_blacklist.pop(netsettings.active_blacklisted_slave_index)
-                       bpy.data.netrender_slaves.append(slave)
+                       slave = bpy.netrender_blacklist.pop(netsettings.active_blacklisted_slave_index)
+                       bpy.netrender_slaves.append(slave)
                        
                        # deal with rna
                        netsettings.slaves.add()
@@ -200,17 +200,17 @@ class RENDER_OT_netclientslaves(bpy.types.Operator):
                        while(len(netsettings.slaves) > 0):
                                netsettings.slaves.remove(0)
                        
-                       bpy.data.netrender_slaves = []
+                       bpy.netrender_slaves = []
                        
                        for s in slaves:
-                               for i in range(len(bpy.data.netrender_blacklist)):
-                                       slave = bpy.data.netrender_blacklist[i]
+                               for i in range(len(bpy.netrender_blacklist)):
+                                       slave = bpy.netrender_blacklist[i]
                                        if slave.id == s.id:
-                                               bpy.data.netrender_blacklist[i] = s
+                                               bpy.netrender_blacklist[i] = s
                                                netsettings.slaves_blacklist[i].name = s.name
                                                break
                                else:
-                                       bpy.data.netrender_slaves.append(s)
+                                       bpy.netrender_slaves.append(s)
                                        
                                        netsettings.slaves.add()
                                        slave = netsettings.slaves[-1]
@@ -236,7 +236,7 @@ class RENDER_OT_netclientcancel(bpy.types.Operator):
                conn = clientConnection(context.scene)
                
                if conn:
-                       job = bpy.data.netrender_jobs[netsettings.active_job_index]
+                       job = bpy.netrender_jobs[netsettings.active_job_index]
                        
                        conn.request("POST", "/cancel", headers={"job-id":job.id})
                        
@@ -294,7 +294,7 @@ class netclientdownload(bpy.types.Operator):
                conn = clientConnection(context.scene)
                
                if conn:
-                       job = bpy.data.netrender_jobs[netsettings.active_job_index]
+                       job = bpy.netrender_jobs[netsettings.active_job_index]
                        
                        for frame in job.frames:
                                client.requestResult(conn, job.id, frame.number)
index 343442b..df75c17 100644 (file)
@@ -122,14 +122,14 @@ class RENDER_PT_network_slaves(RenderButtonsPanel):
                sub.itemO("render.netclientslaves", icon="ICON_FILE_REFRESH", text="")
                sub.itemO("render.netclientblacklistslave", icon="ICON_ZOOMOUT", text="")
                
-               if len(bpy.data.netrender_slaves) == 0 and len(netsettings.slaves) > 0:
+               if len(bpy.netrender_slaves) == 0 and len(netsettings.slaves) > 0:
                        while(len(netsettings.slaves) > 0):
                                netsettings.slaves.remove(0)
                
                if netsettings.active_slave_index >= 0 and len(netsettings.slaves) > 0:
                        layout.itemS()
                        
-                       slave = bpy.data.netrender_slaves[netsettings.active_slave_index]
+                       slave = bpy.netrender_slaves[netsettings.active_slave_index]
 
                        layout.itemL(text="Name: " + slave.name)
                        layout.itemL(text="Address: " + slave.address[0])
@@ -157,14 +157,14 @@ class RENDER_PT_network_slaves_blacklist(RenderButtonsPanel):
                sub = row.column(align=True)
                sub.itemO("render.netclientwhitelistslave", icon="ICON_ZOOMOUT", text="")
 
-               if len(bpy.data.netrender_blacklist) == 0 and len(netsettings.slaves_blacklist) > 0:
+               if len(bpy.netrender_blacklist) == 0 and len(netsettings.slaves_blacklist) > 0:
                        while(len(netsettings.slaves_blacklist) > 0):
                                netsettings.slaves_blacklist.remove(0)
                
                if netsettings.active_blacklisted_slave_index >= 0 and len(netsettings.slaves_blacklist) > 0:
                        layout.itemS()
                        
-                       slave = bpy.data.netrender_blacklist[netsettings.active_blacklisted_slave_index]
+                       slave = bpy.netrender_blacklist[netsettings.active_blacklisted_slave_index]
 
                        layout.itemL(text="Name: " + slave.name)
                        layout.itemL(text="Address: " + slave.address[0])
@@ -195,14 +195,14 @@ class RENDER_PT_network_jobs(RenderButtonsPanel):
                sub.itemO("render.netclientcancelall", icon="ICON_PANEL_CLOSE", text="")
                sub.itemO("render.netclientdownload", icon='ICON_RENDER_ANIMATION', text="")
 
-               if len(bpy.data.netrender_jobs) == 0 and len(netsettings.jobs) > 0:
+               if len(bpy.netrender_jobs) == 0 and len(netsettings.jobs) > 0:
                        while(len(netsettings.jobs) > 0):
                                netsettings.jobs.remove(0)
                
                if netsettings.active_job_index >= 0 and len(netsettings.jobs) > 0:
                        layout.itemS()
                        
-                       job = bpy.data.netrender_jobs[netsettings.active_job_index]
+                       job = bpy.netrender_jobs[netsettings.active_job_index]
 
                        layout.itemL(text="Name: %s" % job.name)
                        layout.itemL(text="Length: %04i" % len(job))
index f914c3c..cd1f7db 100644 (file)
@@ -1392,9 +1392,12 @@ static int pyrna_struct_setattro( BPy_StructRNA * self, PyObject *pyname, PyObje
        if (prop==NULL) {
                // XXX - This currently allows anything to be assigned to an rna prop, need to see how this should be used
                // but for now it makes porting scripts confusing since it fails silently.
+#if 0
                if (!BPy_StructRNA_CheckExact(self) && PyObject_GenericSetAttr((PyObject *)self, pyname, value) >= 0) {
                        return 0;
-               } else {
+               } else
+#endif
+               {
                        PyErr_Format( PyExc_AttributeError, "StructRNA - Attribute \"%.200s\" not found", name);
                        return -1;
                }