[Bf-committers] [Bf-blender-cvs] SVN commit: /data/svn/bf-blender [54136] trunk/blender/source/blender/ editors/space_logic/logic_ops.c: fix annoyance noticed at the global-game-jam, adding controllers would remember previous name.

Campbell Barton ideasman42 at gmail.com
Mon Jan 28 08:00:22 CET 2013


On Mon, Jan 28, 2013 at 5:32 PM, Dalai Felinto <dfelinto at gmail.com> wrote:
> Hi Campbell,
>
> Nice fix. I had no idea of the existence of this flag. So to fix a similar
> bug (commit rev. 54103) I was cleaning the "object" property of the add
> controller operator. So I suspect you didn't really need the PROP_SKIP_SAVE
> for the "object" prop (given my prior attempt at fixing it), but your fix
> seems the right one. I will revert my change.
>
> Now, while debugging "my" bug I noticed that when calling the operator from
> the python console the properties were not saved, only when calling it from
> the UI. Why is that?

So scripts that happen to call operators don't run again with settings
the user never entered, this is really a user level feature, making
scripts save the settings or re-use them would just confuse things.

> Dalai
>
>
> 2013/1/27 Campbell Barton <ideasman42 at gmail.com>
>
>> Revision: 54136
>>
>> http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=54136
>> Author:   campbellbarton
>> Date:     2013-01-28 06:06:55 +0000 (Mon, 28 Jan 2013)
>> Log Message:
>> -----------
>> fix annoyance noticed at the global-game-jam, adding controllers would
>> remember previous name. Would add 'And' controllers and name them 'Python1'
>> for eg.
>>
>> Modified Paths:
>> --------------
>>     trunk/blender/source/blender/editors/space_logic/logic_ops.c
>>
>> Modified: trunk/blender/source/blender/editors/space_logic/logic_ops.c
>> ===================================================================
>> --- trunk/blender/source/blender/editors/space_logic/logic_ops.c
>>  2013-01-28 04:10:47 UTC (rev 54135)
>> +++ trunk/blender/source/blender/editors/space_logic/logic_ops.c
>>  2013-01-28 06:06:55 UTC (rev 54136)
>> @@ -330,8 +330,10 @@
>>         /* properties */
>>         ot->prop = prop = RNA_def_enum(ot->srna, "type",
>> DummyRNA_NULL_items, SENS_ALWAYS, "Type", "Type of sensor to add");
>>         RNA_def_enum_funcs(prop, rna_Sensor_type_itemf);
>> -       RNA_def_string(ot->srna, "name", "", MAX_NAME, "Name", "Name of
>> the Sensor to add");
>> -       RNA_def_string(ot->srna, "object", "", MAX_NAME, "Object", "Name
>> of the Object to add the Sensor to");
>> +       prop = RNA_def_string(ot->srna, "name", "", MAX_NAME, "Name",
>> "Name of the Sensor to add");
>> +       RNA_def_property_flag(prop, PROP_SKIP_SAVE);
>> +       prop = RNA_def_string(ot->srna, "object", "", MAX_NAME, "Object",
>> "Name of the Object to add the Sensor to");
>> +       RNA_def_property_flag(prop, PROP_SKIP_SAVE);
>>  }
>>
>>  /* ************* Add/Remove Controller Operator ************* */
>> @@ -433,6 +435,8 @@
>>
>>  static void LOGIC_OT_controller_add(wmOperatorType *ot)
>>  {
>> +       PropertyRNA *prop;
>> +
>>         /* identifiers */
>>         ot->name = "Add Controller";
>>         ot->description = "Add a controller to the active object";
>> @@ -448,8 +452,10 @@
>>
>>         /* properties */
>>         ot->prop = RNA_def_enum(ot->srna, "type", controller_type_items,
>> CONT_LOGIC_AND, "Type", "Type of controller to add");
>> -       RNA_def_string(ot->srna, "name", "", MAX_NAME, "Name", "Name of
>> the Controller to add");
>> -       RNA_def_string(ot->srna, "object", "", MAX_NAME, "Object", "Name
>> of the Object to add the Controller to");
>> +       prop = RNA_def_string(ot->srna, "name", "", MAX_NAME, "Name",
>> "Name of the Controller to add");
>> +       RNA_def_property_flag(prop, PROP_SKIP_SAVE);
>> +       prop = RNA_def_string(ot->srna, "object", "", MAX_NAME, "Object",
>> "Name of the Object to add the Controller to");
>> +       RNA_def_property_flag(prop, PROP_SKIP_SAVE);
>>  }
>>
>>  /* ************* Add/Remove Actuator Operator ************* */
>> @@ -551,8 +557,10 @@
>>         /* properties */
>>         ot->prop = prop = RNA_def_enum(ot->srna, "type",
>> DummyRNA_NULL_items, CONT_LOGIC_AND, "Type", "Type of actuator to add");
>>         RNA_def_enum_funcs(prop, rna_Actuator_type_itemf);
>> -       RNA_def_string(ot->srna, "name", "", MAX_NAME, "Name", "Name of
>> the Actuator to add");
>> -       RNA_def_string(ot->srna, "object", "", MAX_NAME, "Object", "Name
>> of the Object to add the Actuator to");
>> +       prop = RNA_def_string(ot->srna, "name", "", MAX_NAME, "Name",
>> "Name of the Actuator to add");
>> +       RNA_def_property_flag(prop, PROP_SKIP_SAVE);
>> +       prop = RNA_def_string(ot->srna, "object", "", MAX_NAME, "Object",
>> "Name of the Object to add the Actuator to");
>> +       RNA_def_property_flag(prop, PROP_SKIP_SAVE);
>>  }
>>
>>  /* ************* Move Logic Bricks Operator ************* */
>>
>> _______________________________________________
>> Bf-blender-cvs mailing list
>> Bf-blender-cvs at blender.org
>> http://lists.blender.org/mailman/listinfo/bf-blender-cvs
>>
> _______________________________________________
> Bf-committers mailing list
> Bf-committers at blender.org
> http://lists.blender.org/mailman/listinfo/bf-committers



-- 
- Campbell


More information about the Bf-committers mailing list