The ID struct isn't writen, but there's nothing that checks for pointers to 
that struct. It's done on load when remapping pointers, which was my point.

This is nasty because, while the image will have a user count of zero, it will 
still continue being used normally by other datablocks until the file is saved 
and reopened.

Martin

--- On Tue, 2/23/10, Campbell Barton <[email protected]> wrote:

> From: Campbell Barton <[email protected]>
> Subject: Re: [Bf-committers] [Bf-blender-cvs] SVN commit: 
> /data/svn/bf-blender [27105] trunk/blender: - finally a way to force removal 
> of images (Shift+Click on the X)
> To: "bf-blender developers" <[email protected]>
> Received: Tuesday, February 23, 2010, 11:45 AM
> zero user pointers are not written so
> there are no dangling pointer
> problems on load :)
> 
> On Tue, Feb 23, 2010 at 5:35 PM, Martin Poirier <[email protected]>
> wrote:
> > My point was that it might lead to unexpected
> behavior.
> >
> > If I understood correctly, it forces the user count to
> 0, which means that there will be dangling pointers on load
> (I think they might be nulled then, but that's using an
> error recovery side effect to achieve something on the
> "normal" path and that's nasty).
> >
> > Martin
> >
> > --- On Tue, 2/23/10, Dalai Felinto <[email protected]>
> wrote:
> >
> >> From: Dalai Felinto <[email protected]>
> >> Subject: Re: [Bf-committers] [Bf-blender-cvs] SVN
> commit: /data/svn/bf-blender [27105] trunk/blender: -
> finally a way to force removal of images (Shift+Click on the
> X)
> >> To: "bf-blender developers" <[email protected]>
> >> Received: Tuesday, February 23, 2010, 11:05 AM
> >> >Isn't that nasty if the image is
> >> assigned to a face as UV or a texture or
> >> as background image or whatever?
> >> That's the whole point of forcing the removal.
> Blender
> >> keeps weird datablock
> >> pointers impossible to remove (user point of view
> here).
> >>
> >> A popup telling which datablocks are linked to
> this image
> >> wouldnt hurt. But
> >> still a must feature !
> >>
> >> Thanks a lot Campbell,
> >>
> >> Dalai
> >> http://blenderecia.orgfree.com
> >>
> >>
> >> 2010/2/23 Martin Poirier <[email protected]>
> >>
> >> > Isn't that nasty if the image is assigned to
> a face as
> >> UV or a texture or
> >> > as background image or whatever?
> >> >
> >> > Martin
> >> >
> >> > --- On Tue, 2/23/10, Campbell Barton <[email protected]>
> >> wrote:
> >> >
> >> > > From: Campbell Barton <[email protected]>
> >> > > Subject: [Bf-blender-cvs] SVN commit:
> >> /data/svn/bf-blender [27105]
> >> > trunk/blender: - finally a way to force
> removal of
> >> images (Shift+Click on
> >> > the X)
> >> > > To: [email protected]
> >> > > Received: Tuesday, February 23, 2010,
> 10:34 AM
> >> > > Revision: 27105
> >> > >
> >> > http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=27105
> >> > > Author:   campbellbarton
> >> > > Date:     2010-02-23 16:34:02
> >> +0100
> >> > > (Tue, 23 Feb 2010)
> >> > >
> >> > > Log Message:
> >> > > -----------
> >> > > - finally a way to force removal of
> images
> >> (Shift+Click on
> >> > > the X)
> >> > > - generic modal operator now works with
> int's
> >> > >
> >> > > Modified Paths:
> >> > > --------------
> >> > >
> >>    trunk/blender/release/scripts/op/wm.py
> >> > >
> >> > >
> >>
> trunk/blender/source/blender/editors/interface/interface_templates.c
> >> > >
> >> > >
> >>
> trunk/blender/source/blender/makesrna/intern/rna_access.c
> >> > >
> >> > > Modified:
> trunk/blender/release/scripts/op/wm.py
> >> > >
> >>
> ===================================================================
> >> > > ---
> >> > > trunk/blender/release/scripts/op/wm.py
> >> > > 2010-02-23 12:48:35 UTC (rev 27104)
> >> > > +++
> >> > > trunk/blender/release/scripts/op/wm.py
> >> > > 2010-02-23 15:34:02 UTC (rev 27105)
> >> > > @@ -338,7 +338,10 @@
> >> > >
> >> > >          path_item =
> >> > > self.properties.path_item
> >> > >          for item,
> >> value_orig
> >> > > in self._values.items():
> >> > > -
> >> exec("item.%s =
> >> > > %s" % (path_item, value_orig + delta))
> >> > > +            if
> >> > > type(value_orig) == int:
> >> > > +
> >> > > exec("item.%s = int(%d)" % (path_item,
> >> round(value_orig +
> >> > > delta)))
> >> > > +            else:
> >> > > +
> >> > > exec("item.%s = %f" % (path_item,
> value_orig +
> >> delta))
> >> > >
> >> > >      def _values_restore(self):
> >> > >          path_item =
> >> > > self.properties.path_item
> >> > >
> >> > > Modified:
> >> > >
> >>
> trunk/blender/source/blender/editors/interface/interface_templates.c
> >> > >
> >>
> ===================================================================
> >> > > ---
> >> > >
> >>
> trunk/blender/source/blender/editors/interface/interface_templates.c
> >> > > 2010-02-23 12:48:35 UTC (rev 27104)
> >> > > +++
> >> > >
> >>
> trunk/blender/source/blender/editors/interface/interface_templates.c
> >> > > 2010-02-23 15:34:02 UTC (rev 27105)
> >> > > @@ -284,6 +284,10 @@
> >> > >
> >> > > memset(&idptr, 0, sizeof(idptr));
> >> > >
> >> > >
> RNA_property_pointer_set(&template->ptr,
> >> > > template->prop, idptr);
> >> > >
> >> > > RNA_property_update(C,
> &template->ptr,
> >> > > template->prop);
> >> > > +
> >> > > +
> >> > > if(id &&
> >> CTX_wm_window(C)->eventstate->shift)
> >> > > /* useful hidden functionality, */
> >> > > +
> >> > >     id->us= 0;
> >> > > +
> >> > >
> >> > > break;
> >> > >          case
> >> > > UI_ID_FAKE_USER:
> >> > >
> >> > > if(id) {
> >> > > @@ -450,7 +454,7 @@
> >> > >
> >> > > but= uiDefIconButO(block, BUT,
> unlinkop,
> >> > > WM_OP_INVOKE_REGION_WIN, ICON_X, 0, 0,
> UI_UNIT_X,
> >> UI_UNIT_Y,
> >> > > NULL);
> >> > >          }
> >> > >          else {
> >> > > -
> >> > > but= uiDefIconBut(block, BUT, 0, ICON_X,
> 0, 0,
> >> UI_UNIT_X,
> >> > > UI_UNIT_Y, NULL, 0, 0, 0, 0, NULL);
> >> > > +
> >> > > but= uiDefIconBut(block, BUT, 0, ICON_X,
> 0, 0,
> >> UI_UNIT_X,
> >> > > UI_UNIT_Y, NULL, 0, 0, 0, 0, "Unlink
> datablock,
> >> Shift +
> >> > > Click to force removal on save");
> >> > >
> >> > > uiButSetNFunc(but, template_id_cb,
> >> MEM_dupallocN(template),
> >> > > SET_INT_IN_POINTER(UI_ID_DELETE));
> >> > >
> >> > >
> >> > > if(RNA_property_flag(template->prop)
> &
> >> > > PROP_NEVER_NULL)
> >> > >
> >> > > Modified:
> >> > >
> >>
> trunk/blender/source/blender/makesrna/intern/rna_access.c
> >> > >
> >>
> ===================================================================
> >> > > ---
> >> > >
> >>
> trunk/blender/source/blender/makesrna/intern/rna_access.c
> >> > > 2010-02-23 12:48:35 UTC (rev 27104)
> >> > > +++
> >> > >
> >>
> trunk/blender/source/blender/makesrna/intern/rna_access.c
> >> > > 2010-02-23 15:34:02 UTC (rev 27105)
> >> > > @@ -1145,7 +1145,6 @@
> >> > >
> >> > >  int
> RNA_property_editable_flag(PointerRNA
> >> *ptr,
> >> > > PropertyRNA *prop)
> >> > >  {
> >> > > -    ID *id= ptr->id.data;
> >> > >      int flag;
> >> > >
> >> > >      prop=
> >> rna_ensure_property(prop);
> >> > >
> >> > >
> >> > >
> _______________________________________________
> >> > > Bf-blender-cvs mailing list
> >> > > [email protected]
> >> > > http://lists.blender.org/mailman/listinfo/bf-blender-cvs
> >> > >
> >> >
> >> >
> >> >
> >>
>    __________________________________________________________________
> >> > Make your browsing faster, safer, and easier
> with the
> >> new Internet
> >> > Explorer® 8. Optimized for Yahoo! Get it Now
> for
> >> Free! at
> >> > http://downloads.yahoo.com/ca/internetexplorer/
> >> >
> _______________________________________________
> >> > Bf-committers mailing list
> >> > [email protected]
> >> > http://lists.blender.org/mailman/listinfo/bf-committers
> >> >
> >> _______________________________________________
> >> Bf-committers mailing list
> >> [email protected]
> >> http://lists.blender.org/mailman/listinfo/bf-committers
> >>
> >
> >
> >    
>  __________________________________________________________________
> > Yahoo! Canada Toolbar: Search from anywhere on the
> web, and bookmark your favourite sites. Download it now
> > http://ca.toolbar.yahoo.com.
> > _______________________________________________
> > Bf-committers mailing list
> > [email protected]
> > http://lists.blender.org/mailman/listinfo/bf-committers
> >
> 
> 
> 
> -- 
> - Campbell
> _______________________________________________
> Bf-committers mailing list
> [email protected]
> http://lists.blender.org/mailman/listinfo/bf-committers
> 


      __________________________________________________________________
Yahoo! Canada Toolbar: Search from anywhere on the web, and bookmark your 
favourite sites. Download it now
http://ca.toolbar.yahoo.com.
_______________________________________________
Bf-committers mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-committers

Reply via email to